package com.biz.dto.user;

import java.io.Serializable;
import java.util.List;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.Table;
@Entity
@Table(name = "tb_role")
public class RoleDTO implements Serializable{
	private static final long serialVersionUID = 7290776872902712999L;
	@Id
	private int roleId;
	private String roleName;
	
	//extra
	@ManyToMany(targetEntity=FunctionDTO.class, fetch=FetchType.EAGER)
	@JoinTable(name="tb_role_function",joinColumns=@JoinColumn(name="funcId"),
			inverseJoinColumns=@JoinColumn(name="roleId"))
	private List<FunctionDTO> function;
	
	public int getRoleId() {
		return roleId;
	}
	public void setRoleId(int roleId) {
		this.roleId = roleId;
	}
	public String getRoleName() {
		return roleName;
	}
	public void setRoleName(String roleName) {
		this.roleName = roleName;
	}
	
	public List<FunctionDTO> getFunction() {
		return function;
	}
	public void setFunction(List<FunctionDTO> function) {
		this.function = function;
	}
	@Override
	public String toString() {
		return "RoleDTO [roleId=" + roleId + ", roleName=" + roleName + ", function=" + function + "]";
	}
	
	
	
}
